package com.example.yoho.mvp.view.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.yoho.R;
import com.example.yoho.mvp.model.entity.CouponlistEntity;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class CouponAdapter extends BaseQuickAdapter<CouponlistEntity.ValuesBean, BaseViewHolder> {
    public CouponAdapter(int layoutResId, @Nullable List<CouponlistEntity.ValuesBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CouponlistEntity.ValuesBean item) {
        TextView coupon_title=helper.getView(R.id.coupon_title);
        TextView coupon_data=helper.getView(R.id.coupon_data);
        TextView coupon_condition=helper.getView(R.id.coupon_condition);
        coupon_title.setText(item.getCoupon_title());
        coupon_condition.setText(item.getCoupon_condition()+"优惠券");
        long integer = Integer.valueOf(item.getCoupon_data());
        Date date = new Date(integer*1000);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM月dd日HH:mm");
        String format = simpleDateFormat.format(date);
        coupon_data.setText(format);

    }
}
